﻿using System;

namespace SSOCryptography
{
    public class CryptographyFactory
    {
        /// <summary>
        /// Gets the instance.
        /// </summary>
        /// <param name="algorithmName">Name of the cryptographic algorithm.</param>
        /// <returns></returns>
        public static ICryptography GetInstance(string algorithmName)
        {
            ICryptography cryptographyAlgorithm = null;
            if (!string.IsNullOrEmpty(algorithmName))
            {
                try
                {
                    cryptographyAlgorithm = Activator.CreateInstance(Type.GetType("SSOCryptography.Algorithms." + algorithmName))
                                                                        as ICryptography;
                }
                catch { }
            }
            return cryptographyAlgorithm;
        }
    }
}
